Description
There are a number of parameters that govern the precise behavior of the runtime's scheduling service and these are available as method attributes, method member function calls and process attributes.
Method Attributes
Execution Priority
Circuit methods execute preemptively in accordance with their priority (even at network scope - see mobility). CDL supports 32 execution priorities. Zero is the lowest execution priority and 31 is the highest.
Mobility
This attribute determines whether the instantiated method will be executed by the master process or farmed out to slave processes.
State Data Affinity
This attribute determines whether a slave-able method's state data is automatically flushed back to the master (Endpoint), or left in the slave process that last executed it (Floatpoint). In the latter case, the state can be moved directly from slave to slave (without going via the master) each time the executing process changes. Floatpoint affinity can therefore reduce total bandwidth but in the event that the owning slave makes an unscheduled exit, may result in loss of definitive data.
Process Scheduling Attributes
Initial Worker Count
Determines initial worker thread concurrency. It is typically set to '1' for initial development because this will make execution more repeatable (albeit slower). It is usually defaulted to the processor's core count' for deliverable software, which means that the number of workers will be determined at runtime and automatically scale to the target platform.
Max Worker Count
Determines the maximum number of workers that the system can create at any given priority. If a process contains methods whose manual connections can block (e.g. a write to a transient store), then the scheduler may need to create additional threads if it detects potential deadlocks. This attribute determines the maximum number of workers that can be created and is usually set to be 'unlimited'.
Job Overlap
Determines the number of jobs that each slave process can buffer up. This allows the scheduler to overlap processing and communication for slave-able applications. If it is set to '1' then jobs are not sent until existing jobs are completed (no overlap). If it is set to '2' then a second job can be sent to a given slave whilst it is processing the first. The bigger the overlap the less likely it is that a slave is stalled waiting for available work. If the overlap is too high however, then some slaves could be left with residual tasks whilst adjacent slaves have completed all of their allocated tasks. The best value is usually between 2 and 4 but this is probably best optimized empirically.
Process Instance Attributes
Min Slave Count
Determines the number of slaves that must connect before activating circuitry.
Max Slave Count
Determines the maximum number of slaves that can connect.
Min Sub Master Count
Determines the number of sub-masters that must connect before activating circuitry.
Max Sub Master Count
Determines the maximum number of sub-masters that can connect.
Pinning
Uns Pin( Uns SlaveId );
This function will 'pin' the executing method element to the specified slave. Once 'pinned', the method will always be scheduled to the specified slave. This function can be safely executed in autonomous builds but does not have any effect. This ensures repeatable execution in all configurations. Pinning is usually adopted for methods that have large state objects that cannot be efficiently moved between subsequent executions. Pinning is typically performed in the method element's 'Initialise' code and should always be performed before State and/or Workspace objects are constructed and initialized (see State and Workspace Objects).